#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

//sort a[left..right]
//T(n)=T(n-1)+O(n)=>T(n)=O(n^2)
void select_sort(int *a, int left, int right) {
    if (left >= right)return;
    int k = left;
    for (int i = left + 1; i <= right; i++) {
        if (a[i] < a[k]) {
            k = i;
        }
    }
    swap(a[k], a[left]);
    select_sort(a, left + 1, right);


}

int main() {
    int a[] = {1, 3, 5, 7, 9, 2, 4, 6, 8, 0};
    select_sort(a, 0, 9);//a[0..9]
    for (int i = 0; i < 10; i++) {
        cout << a[i] << " ";
    }
    return 0;
}
